Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@emotion/core

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emotion/core

> Simple styling in React.

  • 10.3.1
  • ten
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @emotion/core?

The @emotion/core package is a powerful library for writing css styles with JavaScript. It is part of the Emotion library, which is designed to write CSS styles in JavaScript files, allowing for dynamic styling in React applications. It provides APIs to write styles in a more expressive and concise way, supports server-side rendering, and offers a way to compose and reuse styles.

What are @emotion/core's main functionalities?

Styled Components

Allows the creation of styled components using the `css` prop. This feature enables the application of styles directly to components in a React application.

{"import { css } from '@emotion/core';\n\nconst style = css`\n  color: hotpink;\n`;\n\nconst MyComponent = () => (\n  <div css={style}>\n    This is a pink text.\n  </div>\n);"}

Composition

Supports composing multiple style definitions into a single component, allowing for more modular and reusable styles.

{"import { css } from '@emotion/core';\n\nconst base = css`\n  background: white;\n  color: black;\n`;\n\nconst danger = css`\n  color: red;\n`;\n\nconst DangerButton = () => (\n  <button css={[base, danger]}>\n    Delete\n  </button>\n);"}

Theming

Enables theming support, allowing for styles to be dynamically changed based on a provided theme. This is useful for implementing theme switching in applications.

{"import { ThemeProvider } from 'emotion-theming';\n\nconst theme = {\n  color: 'hotpink'\n};\n\nconst ThemedComponent = () => (\n  <ThemeProvider theme={theme}>\n    <div css={theme => ({\n      color: theme.color\n    })}>\n      This text is hotpink.\n    </div>\n  </ThemeProvider>\n);"}

Other packages similar to @emotion/core

FAQs

Package last updated on 08 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc